<?php

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Session;
use think\Db;

class Rule extends Base
{

    /**
     * @param Request $request
     * @return \think\response\View
     *
     */
    public function index(Request $request)
    {
        $stay_time   = $request->param('stay_time');
        $stay_length = $request->param('stay_length');
        $gaze_time   = $request->param('gaze_time');
        $gaze_length = $request->param('gaze_length');

        if ($stay_time and $stay_length and $gaze_time and $gaze_length) {
            Db::table('ad_regular')->where('id', 1)->update([
                'stay_time' => $stay_time,
                'stay_length' => $stay_length,
                'gaze_time' => $gaze_time,
                'gaze_length' => $gaze_length
            ]);
        }
        $data = Db::table('ad_regular')->find(1);
        return view('index', compact('data'));
    }


}